package com.lmc.util;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.text.TextUtils;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.qxzn.app.api.api.HttpRequest;

public class GlideUtil {

    /**
     * 加载图片
     */
    public static void setImg(Context context, ImageView imageView, String uri) {

        if (TextUtils.isEmpty(uri)) {

            return;
        }
        if (!uri.startsWith("http")) {
            uri = HttpRequest.BASE_URL + uri;
        }

        Glide.with(context)
                .asBitmap() // some .jpeg files are actually gif
                .load(uri)
                .apply(new RequestOptions()
                        .centerCrop())
                .into(imageView);
    }
}
